<div class="layui-card-body padding-left-40">
    <label class="layui-form-item layui-col-lg12" style="display: flex;justify-content: space-between">
        <label class="layui-form-item layui-col-lg5">
            <span class="color-green font-w7">	标题</span>
            <span class="color-desc margin-left-5">Select Storehouse</span>
            <div class="layui-input layui-bg-gray">{$storehouseInfo.title|default=''}</div>
        </label>
        <label class="layui-form-item block relative layui-col-lg5">
            <span class="color-green font-w7">所属仓库</span>
            <span class="color-desc margin-left-5">Select Storehouse</span>
            <div class="layui-input layui-bg-gray">{$storehouse_name|default=''}</div>
        </label>
    </label>
    <label class="layui-form-item layui-col-lg12" style="display: flex;justify-content: space-between">
        <label class="layui-form-item block relative layui-col-lg5">
            <span class="color-green font-w7">	所属人</span>
            <span class="color-desc margin-left-5">Select Storehouse</span>
            <div class="layui-input layui-bg-gray">{$storehouseInfo.admin_name|default='公共仓库'}</div>
        </label>
        <label class="layui-form-item block relative layui-col-lg5">
            <span class="color-green font-w7">	时间</span>
            <span class="color-desc margin-left-5">Select Storehouse</span>
            <div class="layui-input layui-bg-gray">{$storehouseInfo.create_at|default=''}</div>
        </label>
    </label>
    <div class="layui-form-item">
        <div class="relative block">
            <div style="display: flex;justify-content: space-between;">
                <div>
                    <span class="color-green font-w7">库存数据</span>
                    <span class="color-desc margin-left-5">Storehouse Data</span>
                </div>
                
                <button id="btn" class="layui-btn" type='submit' style="float: right;">导  出</button>
            </div>
            <table class="layui-table margin-top-12 table2excel" lay-skin="line" id='dataInfo' lay-filter="demo">
                <thead>
                <tr>
                    <th class="text-center">编号</th>
                    <th class="text-center">名称</th>
                    <th class="text-center">规格</th>
                    <th class="text-center">单位</th>
                    <th class="text-center">单价</th>
                    <th class="text-center">数量</th>
                    <th class="text-center">总价</th>
                    <th class="text-center"></th>
                </tr>
                </thead>
                <tbody id="one_add">
                <style>
                    #dataInfo{overflow-y: auto;max-height: 45vh;display: block;}
                    /*td input{width:100%;text-align: center;border: none;}*/
                    td {width:12.5%;}
                    
                </style>
                {volist name='lists' id='val'}
                <!--<tr>-->
                <!--    <input type='hidden' name='cate_id[]' value="{$val.cate_id|default='--'}">-->
                <!--    <td class='text-center'><input readonly type='text' name='material_code[]' value="{$val.material_code|default='--'}"></td>-->
                <!--    <td class='text-center'><input readonly type='text' name='material_name[]' value="{$val.material_name|default='--'}"></td>-->
                <!--    <td class='text-center'><input readonly type='text' name='material_model[]' value="{$val.material_model|default='--'}"></td>-->
                <!--    <td class='text-center'><input readonly type='text' name='material_unit[]' value="{$val.material_unit|default='--'}"></td>-->
                <!--    <td class='text-center'><input readonly type='text' name='material_price[]' value="{$val.material_price|default='--'}"></td>-->
                <!--    <td class='text-center'><input readonly type='number' name='material_num[]' value="{$val.material_num|default='--'}"></td>-->
                <!--    <td class='text-center'><input readonly type='text' name='material_xjprice[]' value="{$val.material_xjprice|default='--'}"></td>-->
                <!--    <td class='nowrap'>-->
                <!--        <a class="layui-btn layui-btn-xs layui-btn-danger" data-action="{:url('give_back_num')}" data-confirm="确定清零该物资吗？清零后数据无法恢复，请谨慎操作！" data-value="id#{$val.id}">数量清零</a>-->
                <!--    </td>-->
                <!--</tr>-->
                <tr>
                    <td class='text-center'>{$val.material_code|default=''}</td>
                    <td class='text-center'>{$val.material_name|default=''}</td>
                    <td class='text-center'>{$val.material_model|default=''}</td>
                    <td class='text-center'>{$val.material_unit|default=''}</td>
                    <td class='text-center'>{$val.material_price|default=''}</td>
                    <td class='text-center'>{$val.material_num|default=''}</td>
                    <td class='text-center'>{$val.material_xjprice|default=0}</td>
                    <input type='hidden' name='cate_id[]' value="{$val.cate_id|default='--'}">
                    <td class='nowrap noExl'>
                        <a class="layui-btn layui-btn-xs layui-btn-danger" data-action="{:url('give_back_num')}" data-confirm="确定清零该物资吗？清零后数据无法恢复，请谨慎操作！" data-value="id#{$val.id}">数量清零</a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
        </div>
        
    </div>
    
</div>

    <div class="layui-form-item text-center " style="padding:40px">
        <button class="layui-btn layui-layer-close layui-layer-close1" type='submit'>关闭</button>
    </div>
    <script src="__ROOT__/static/jquery.table2excel.js"></script>
<script>
    $(function() {
        $("#btn").click(function(){
            $(".table2excel").table2excel({
                exclude: ".noExl",
                name: "物资计划",
                filename: "{$storehouseInfo.title}",
                exclude_img: true,
                exclude_links: false,
                exclude_input: true
            });
        });
    });
</script>
    <script>
        form.render()
        function refusalCause(ids) {
            var remarkReason = "";
            layer.prompt({
                formType: 0,
                value: '',
                title: '请输入退还数量',
                btn: ['确定','取消'], //按钮，
                btnAlign: 'c'
            }, function(value,index){
                remarkReason = value;
                layer.close(index);
                $.ajax({
                    type: 'POST',
                    url: "{:url('give_back_num')}",
                    data: {
                        id: ids,
                        num: remarkReason
                    },
                    dataType: "json",
                    success: function (data) {
                        console.log(data)
                        if(data.code==1){
                            layer.msg(data.info, {icon: 1},function () {
                                console.log(index)
                                layer.msg(data.info,{time: 3000, icon:1})
                                parent.location.reload();
                            });
                        }else{
                            layer.msg(data.info,{time: 3000, icon:2})
                        }
                    }
                });
            },function (value,index) {

            });
        }
    </script>